package com.ch.shopping.controller;

import com.ch.shopping.pojo.User;
import com.ch.shopping.service.UserSevice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author AuthorName
 * @create 2020-04-15 7:20
 */
@RestController
@RequestMapping("/user")
public class UserManageController {
    @Autowired
    private UserSevice userSevice;
    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
    public User test(@PathVariable("id") Integer id) {
        User user = userSevice.queryById(id);
        return user;
    }
    @RequestMapping(value = "/like/{name}",method = RequestMethod.GET)
    public List<User> test01(@PathVariable("name") String name){
      return userSevice.queryUsersByLikeName(name);
    }
}
